cmake_minimum_required(VERSION 2.8)
project(FACTORIZE)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/external/armadillo-3.6.2/build_aux/cmake/Modules/")

set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/net/hg200/tqlong/local")

find_package(MPI)
find_package(OpenCV)

link_directories(
  /usr/lib64/atlas
  /usr/lib64
  /net/hg200/tqlong/local/lib
)

include_directories(
  ${CMAKE_SOURCE_DIR}/external/armadillo-3.6.2/include
  /net/hg200/tqlong/local/include
  ${MPI_INCLUDE_PATH}
  ${OpenCV_INCLUDE_DIRS}
)

add_definitions(-O3)

subdirs(  
  external
)

set(ALL_LIBS 
  armadillo
  boost_date_time
  boost_program_options
  boost_mpi
  ${MPI_LIBRARIES}
  opencv_core
  opencv_highgui
)

add_executable(testlib
  testlib.cc
)

target_link_libraries(testlib
  ${ALL_LIBS}
)

add_executable(nmf
  nmf_main.cc
  anls_concensus.cc
  anls_decentralized.cc
  anls_sparse.cc
  anls_sequential.cc
  anls_decentralized_less.cc
  bpp_map_reduce.cc
  bpp_map_reduce_manyrhs.cc
  bpp_sequential.cc
  bcd_sequential.cc
  arma_helper.cc
)

target_link_libraries(nmf
  ${ALL_LIBS}
)

